<?php
    $array_menus = array();
	$section = '';
	$link = '';
    $filter = array();
    $filter['parent_id'] = 0;
    $filter['type'] = 1;
    MenuComponent::getMenuList($array_menus, $filter);
?>

<div id="menu-admin">
    <div style="float: left" id="my_menu" class="sdmenu">
        <?php if(isset($array_menus)) foreach($array_menus as $pid=>$pmenu) {?>
            <?php if (in_array(Yii::app()->session["group_id"], $pmenu['parent']["ALLOW_ACCESS"])) {?>
                <div <?php if($section == $pmenu['parent']['SECTION']) { ?> class="collapsed"<?php } ?>>
                    <span><?php echo CHtml::encode($pmenu['parent']['NAME']); ?></span>
                    <?php if(count($pmenu['childs'])) {?>
                        <?php foreach($pmenu['childs'] as $cid=>$cmenu) {?>
                            <?php if (in_array(Yii::app()->session["group_id"], $cmenu['child']["ALLOW_ACCESS"])) {?>
                                <a <?php if($link == $cmenu['child']['LINK']) { ?> class="current"<?php } ?> href="<? echo Yii::app()->baseUrl.'/'.$cmenu['child']['LINK']; ?>"><?php echo CHtml::encode($cmenu['child']['NAME']); ?></a>
                            <?php } ?>
                        <?php } ?>
                    <?php }?>
                </div>
            <?php } ?>
        <?php } ?>
    </div>
</div>